package com.hcc.repository.gen.config;

import com.hcc.repository.core.utils.StrUtils;
import com.hcc.repository.extension.repository.IRepositoryImpl;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * RepositoryImplConfig
 *
 * @author hushengjun
 * @date 2023/9/17
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class RepositoryImplConfig extends BasicConfig {

    private static final String DEFAULT_SUFFIX = "RepoImpl";
    private String springAnnotationType = SpringAnnotationType.Repository.name();

    @Override
    public Class<?> getSuperClass() {
        return super.getSuperClass() == null ? IRepositoryImpl.class : super.getSuperClass();
    }

    @Override
    public String getSuffix() {
        return StrUtils.isEmpty(super.getSuffix()) ? DEFAULT_SUFFIX : super.getSuffix();
    }

    public void setSpringAnnotationType(SpringAnnotationType springAnnotationType) {
        this.springAnnotationType = springAnnotationType.name();
    }

    public enum SpringAnnotationType {
        Repository, Component, Service
    }

}
